package com.cskaoyan.bean.promotion.coupon;

import com.cskaoyan.util.DateUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: WD created on 2021-09-16 19:21
 * @Version:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CouponListVO {
    private Integer id;
    private String name;
    private String desc;
    private String tag;
    private Integer total;
    private Double discount;
    private Double min;
    private Short limit;
    private Short type;
    private Short status;
    private Short goodsType;
    private Integer[] goodsValue;
    private Short timeType;
    private Short days;
    private String addTime;
    private String updateTime;
    private Boolean deleted;
    private String code;
    private String startTime;
    private String endTime;


    public CouponListVO(Coupon coupon) {

        this.id = coupon.getId();
        this.name = coupon.getName();
        this.desc = coupon.getDesc();
        this.tag = coupon.getTag();

        this.total = coupon.getTotal();

        this.discount = coupon.getDiscount();

        this.min = coupon.getMin();

        this.limit = coupon.getLimit();

        this.type = coupon.getType();

        this.status = coupon.getStatus();

        this.goodsType = coupon.getGoodsType();

        this.goodsValue = coupon.getGoodsValue();

        this.timeType = coupon.getTimeType();

        this.days = coupon.getDays();
        this.addTime = DateUtils.dateFormat(coupon.getAddTime());
        this.updateTime = DateUtils.dateFormat(coupon.getUpdateTime());

        this.deleted = coupon.getDeleted();
        this.code = coupon.getCode();
        if (coupon.getStartTime() != null) {
            this.startTime = DateUtils.dateFormat(coupon.getStartTime());
        }
        if (coupon.getEndTime() != null) {
            this.endTime = DateUtils.dateFormat(coupon.getEndTime());
        }


    }
}
